<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
    protected function _initAutoloader()
    {
        $this->bootstrap('FrontController');
        $front = $this->getResource('FrontController');

        $moduleDir = dirname($front->getModuleDirectory());
        $modules = Custom_Utility_Dir::getSubDirs($moduleDir);

        foreach ($modules as $key => $value) {
            $loader = new Zend_Application_Module_Autoloader(array(
                    'namespace' => ucfirst($value),
                    'basePath' => $front->getModuleDirectory($value)
            ));
            $loader->addResourceTypes(array(
                'table' => array(
                    'path' => 'models/tables',
                    'namespace' => 'Table',
                ),
                'tablerow' => array(
                    'path' => 'models/tables/rows',
                    'namespace' => 'Table_Row'
            )));
        }
    }

   protected function _initRoutes()
    {
        $config = new Zend_Config_Ini(
            APPLICATION_PATH . '/config/routing.ini', 'production'
        );
        $this->bootstrap('frontController');
        $router = $this->frontController->getRouter();
        $router->addConfig($config, 'routes');
    }

}

